#include <cstring>
#include "simpleStack.hpp"
using namespace std;

SimpleStack::SimpleStack()
{
    memset(stack, 0, sizeof(stack));  // -1 表示空栈
}

void SimpleStack::push(uint16_t value)
{
    if (top < STACK_SIZE) {
        top++;
    } else {
        memcpy(stack, stack + 1, sizeof(stack));  // 通过移位清除栈底
    }
    stack[top - 1] = value;
}

uint16_t SimpleStack::pop()
{
    if (top > 0) {
        top--;
        return stack[top];
    }
    return -1;
}

bool SimpleStack::checkNumIn(uint16_t index, uint16_t num)
{
    return false;
}
